﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.Linq;

namespace StartUp
{
    [RunInstaller(true)]
    public partial class StartUpInstaller : System.Configuration.Install.Installer
    {
        public StartUpInstaller()
        {
            InitializeComponent();
        }

        protected override void OnAfterInstall(IDictionary savedState)
        {
            var path = Context.Parameters["TARGETDIR"].ToString() + "\\VirtualCamera\\install.bat";
            using (Process pro = new Process())
            {
                pro.StartInfo.FileName = path;
                pro.StartInfo.UseShellExecute = false;
                pro.StartInfo.CreateNoWindow = true;
                pro.Start();
            }

            var startpath = Context.Parameters["TARGETDIR"].ToString() + "\\OneService.exe";
            Process.Start(startpath);
            base.OnAfterInstall(savedState);
        }
    }
}
